<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>显示退住信息</title>
    <link rel="stylesheet" href="webjars/bootstrap/3.3.5/css/bootstrap.css" type="text/css">
    <script src="webjars/jquery/3.4.1/jquery.js"></script>
</head>
<body>
<h2>登记退住列表&emsp;&emsp;<button type="button" onclick="history.go(-1)" class="glyphicon glyphicon-share-alt" aria-hidden="true" th:bgcolor="grey"></button></h2>
<form action="/searchW">
    <table>
        <tr>
            <td>查询条件：</td>
            <td bgcolor="#f0ffff">&emsp;<input name="name" type="text" placeholder="请输入退住人姓名">&emsp;</td>
            <td bgcolor="#f0ffff"><input type="submit" value="查询"></td>
            <td>&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<a th:href="@{'/addWith'}" class="btn btn-info">
                <span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span>退住办理</a></td>
        </tr>
    </table>
</form><br>
<table class="table table-hover">
    <tr>
        <th>序号</th>
        <th>客户姓名</th>
        <th>性别</th>
        <th>年龄</th>
        <th>档案号</th>
        <th>入住时间</th>
        <th>退住时间</th>
        <th>退住类型</th>
        <th>退住原因</th>
        <th>状态</th>
        <th>申请时间</th>
        <th>审核意见</th>
        <th>审核人</th>
        <th>审核时间</th>
        <th>备注</th>
        <th>其它操作</th>
    </tr>
    <tr th:each="w:${ws}">
        <td th:text="${w.id}"></td>
        <td th:text="${w.name}"></td>
        <td th:text="${w.sex}"></td>
        <td th:text="${w.age}"></td>
        <td th:text="${w.fnumber}"></td>
        <td th:text="${w.citime}"></td>
        <td th:text="${w.withdrawaltime}"></td>
        <td th:text="${w.withdrawatype}"></td>
        <td th:text="${w.withdrawareason}"></td>
        <td th:text="${w.status}"></td>
        <td th:text="${w.apptime}"></td>
        <td th:text="${w.auditopinion}"></td>
        <td th:text="${w.reviewer}"></td>
        <td th:text="${w.reviewtime}"></td>
        <td th:text="${w.remarks}"></td>
        <td>
            <a th:href="@{'/withdrawal/'+${w.id}}" class="btn btn-info">修改</a>
            <a th:onclick="|deleteWith(this, ${w.id})|" class="btn btn-warning">删除</a>
            <a th:href="@{'/withdrawal2/'+${w.id}}" class="btn btn-danger">审核</a>
        </td>
    </tr>
</table>
<script>
    function deleteWith(obj,id) {
        if(confirm("确定要删除么？")){
            alert("要删除的所退住编号："+id);
            //发送删除操作请求
            $.ajax({
                url: "/withdrawal/"+id,
                type: "DELETE",
                success: function (result) {
                    // alert(result);
                    if(result==="success"){
                        //删除当前行
                        $(obj ).parent().parent().remove();
                    }else{
                        alert("这个信息不能删除....");
                    }
                }
            });
        }else{
            alert("撤销删除操作")
        }

    }
</script>
</body>
</html>